<?php
namespace Admin\Controller;
use Think\Controller;
class LoginController extends Controller {
    public function index(){
        $this->display();
    }

    public function checkdata()
    {
    	$data = I('post.');


      	$user = M('admin')->where(['username'=>$data['username'],'password'=>md5($data['password'])])->find();


      	if($user){

      		$_SESSION['aid'] = $user['aid'];
      		$_SESSION['username'] = $user['username'];
      		$this->ajaxReturn(['error'=>0,'info'=>'登录成功']);

      	}else{

      		$this->ajaxReturn(['error'=>1,'info'=>'帐号密码不正确']);

      	}

    }
}